const express = require('express');
const router = express.Router();
const exerciseController = require('../controllers/exercise');
const { exerciseGenerateValidator } = require('../middleware/validator');

/**
 * @route POST /api/exercise/generate
 * @desc 生成练习题
 * @access Public
 */
router.post('/generate', exerciseGenerateValidator, exerciseController.generateExercise);

/**
 * @route GET /api/exercise/export/:resourceId
 * @desc 导出练习题为PDF
 * @access Public
 */
router.get('/export/:resourceId', exerciseController.exportExercise);

/**
 * @route GET /api/exercise/:resourceId
 * @desc 获取练习题详情
 * @access Public
 */
router.get('/:resourceId', exerciseController.getExerciseDetail);

module.exports = router;